﻿<UserControl x:Class="AgileToDo.UPItem"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" MouseDoubleClick="UserControl_MouseDoubleClick"
             MouseLeftButtonDown="UserControl_MouseLeftButtonDown">
    <UserControl.Resources>
        <Storyboard  x:Key="sbShow">
            <DoubleAnimation
                     Storyboard.TargetName="imgClose"
                    Storyboard.TargetProperty="Opacity" 
                    From="0" To="1" Duration="0:0:0.01"
                    />
            <DoubleAnimation
                    Storyboard.TargetProperty="Height" 
                    From="28" To="30" Duration="0:0:0.1"
                    />
        </Storyboard>
        <Storyboard  x:Key="sbHide">
            <DoubleAnimation
                      Storyboard.TargetName="imgClose"
                    Storyboard.TargetProperty="Opacity" 
                    From="1" To="0" Duration="0:0:0.01"
                    />
            <DoubleAnimation
                    Storyboard.TargetProperty="Height" 
                     From="30" To="28" Duration="0:0:0.1"
                    />
        </Storyboard>
    </UserControl.Resources>
    <Canvas  Height="28"   Margin="1.5" >
        <Border x:Name="border" Width="154"  Height="28" Background="#FF103684"
                CornerRadius="1" 
                BorderBrush="Black"
                BorderThickness="0.5" MouseLeftButtonDown="border_MouseLeftButtonDown" 
           >
            <Border.Triggers>
                <EventTrigger RoutedEvent="Border.MouseEnter">
                    <BeginStoryboard Storyboard="{StaticResource sbShow}"/>
                </EventTrigger>
                <EventTrigger RoutedEvent="Border.MouseLeave">
                    <BeginStoryboard Storyboard="{StaticResource sbHide}"/>
                </EventTrigger>
            </Border.Triggers>
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
                <TextBlock Margin="5,0,0,0" x:Name="label" 
                           Text="{Binding ElementName=tbx,Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                           Grid.Column="1"  FontSize="14"   VerticalAlignment="Center" Foreground="White"/>
                <TextBox  Width="154"  Grid.Column="1"  FontSize="14" 
                         Text="{Binding ProjectName, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" x:Name="tbx"  
                          Visibility="Collapsed"  LostFocus="tbx_LostFocus" ></TextBox>
        </Grid>
        </Border>
        <Image x:Name="imgClose" Height="18" Width="18" Canvas.Right="5" 
               ToolTip="Delete" Opacity="0"
               Source="image\delete.png" Canvas.Top="7"
               MouseLeftButtonDown="imgClose_MouseLeftButtonDown" >
            <Image.Triggers>
                <EventTrigger RoutedEvent="Image.MouseLeave">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                    Storyboard.TargetProperty="Opacity" 
                    From="1" To="0" Duration="0:0:0.01"
                    />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="Image.MouseEnter">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                    Storyboard.TargetProperty="Opacity" 
                    From="0" To="1" Duration="0:0:0.01"
                    />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>

            </Image.Triggers>
        </Image>
    </Canvas>
</UserControl>
